package org.benetech.beans.error;

/**
 * A bean describing a validation error.
 * @author Reuben Firmin
 */
public interface ValidationError {

    /**
     * A severity level for a violation.
     * @author Reuben Firmin
     */
    public enum Severity {

        /** Informational only, doesn't need to be fixed. */
        INFO("Info:"),
        /** Bad, but not a showstopper. */
        WARNING("Warning:"),
        /** Prevents validation from succeeding. */
        ERROR("Error:");

        private String msg;

        /**
         * Constructor.
         * @param msg A human readable representation of the severity level.
         */
        private Severity(final String msg) {
            this.msg = msg;
        }

        /**
         * A human readable representation of the severity level.
         * @return never null.
         */
        public String getMsg() {
            return msg;
        }
    }


    /**
     * Get the severity of the violation. This will be used to determine whether
     * overall validation succeeds.
     * @return Never null.
     */
    Severity getSeverity();

    /**
     * String representation that can be displayed to the user.
     * @return never null.
     */
    String toString();

}
